// 缓存布局路由，防止重加载
const Layout = () => import('../layout/index.vue')

export const baseRoutes = [
  {
    path: '/',
    name: 'home',
    component: Layout,
    redirect: '/welcome',
    meta: {
      icon: 'HomeFilled',
      title: '首页',
      showLink: true
    },
    children: [
      {
        path: '/welcome',
        name: 'welcome',
        component: () => import('../views/welcome/index.vue'),
        meta: {
          title: '首页'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue'),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/examples',
    name: 'examples',
    component: Layout,
    redirect: '/examples/table',
    meta: {
      icon: 'Guide',
      title: '例子',
      showLink: true
    },
    children: [
      {
        path: '/examples/ganttChart',
        name: 'examplesGanttChart',
        component: () => import('@/views/examples/GanttChart.vue'),
        meta: {
          icon: 'TrendCharts',
          title: '甘特图',
          showLink: true
        }
      },
      {
        path: '/examples/table',
        name: 'examplesTable',
        component: () => import('@/views/examples/Table.vue'),
        meta: {
          icon: 'Grid',
          title: '表格',
          showLink: true
        }
      },
      {
        path: '/examples/editor',
        name: 'examplesEditor',
        component: () => import('@/views/examples/Editor.vue'),
        meta: {
          icon: 'EditPen',
          title: '编辑器',
          showLink: true
        }
      },
      {
        path: '/examples/media',
        name: 'examplesMedia',
        component: () => import('@/views/examples/Media.vue'),
        meta: {
          icon: 'Camera',
          title: '媒体设备',
          showLink: true
        }
      },
      {
        path: '/examples/workflow',
        name: 'examplesWorkflow',
        redirect: '/examples/workflow/workflowExamine/examinations',
        meta: {
          icon: 'Operation',
          title: '工作流',
          showLink: true
        },
        children: [
          {
            path: '/examples/workflow/examine',
            name: 'examplesWorkflowExamine',
            component: () => import('@/views/examples/workflow/examine/index.vue'),
            redirect: '/examples/workflow/examine/examinations',
            meta: {
              icon: 'Stamp',
              title: '工作流审批',
              showLink: true
            },
            children: [
              {
                path: '/examples/workflow/examine/templates',
                name: 'examplesWorkflowExamineTemplate',
                component: () => import('@/views/examples/workflow/examine/templates/index.vue'),
                meta: {
                  icon: 'Edit',
                  title: '表单工作流模板',
                  showLink: true
                }
              },
              {
                path: '/examples/workflow/examine/examinations',
                name: 'examplesWorkflowExamineExaminations',
                component: () => import('@/views/examples/workflow/examine/examinations/index.vue'),
                meta: {
                  icon: 'List',
                  title: '审批列表',
                  showLink: true
                }
              }
            ]
          },
          {
            path: '/examples/workflow/submit',
            name: 'examplesWorkflowSubmit',
            component: () => import('@/views/examples/workflow/submit/index.vue'),
            redirect: '/examples/workflow/submit/submittals',
            meta: {
              icon: 'DocumentAdd',
              title: '工作流提交',
              showLink: true
            },
            children: [
              {
                path: '/examples/workflow/submit/initiate',
                name: 'examplesWorkflowSubmitSubmit',
                component: () => import('@/views/examples/workflow/submit/initiate/index.vue'),
                meta: {
                  icon: 'DocumentAdd',
                  title: '发起申请',
                  showLink: true
                }
              },
              {
                path: '/examples/workflow/submit/submittals',
                name: 'examplesWorkflowSubmitSubmittals',
                component: () => import('@/views/examples/workflow/submit/submittals/index.vue'),
                meta: {
                  icon: 'List',
                  title: '提交申请列表',
                  showLink: true
                }
              }
            ]
          }
        ]
      },
      {
        path: '/examples/webCam',
        name: 'examplesWebCam',
        component: () => import('@/views/examples/WebCam.vue'),
        meta: {
          icon: 'videoCamera',
          title: '网络摄像机',
          showLink: true
        }
      },
      {
        path: '/lowCode',
        name: 'lowCode',
        component: () => import('@/views/examples/LowCodePageEditor.vue'),
        meta: {
          icon: 'Edit',
          title: '低代码编辑',
          showLink: true
        }
      },
      {
        path: '/cadDxf',
        name: 'cadDxf',
        component: () => import('@/views/examples/CadDxf.vue'),
        meta: {
          icon: 'TrendCharts',
          title: 'cad dxf文件',
          showLink: true
        }
      },
      {
        path: '/webRTC',
        name: 'webRTC',
        component: () => import('@/views/examples/WebRTC.vue'),
        meta: {
          icon: 'Connection',
          title: '实时通信',
          showLink: true
        }
      }
    ]
  },
  {
    path: '/error',
    name: 'error',
    component: Layout,
    redirect: '/error/403',
    meta: {
      title: '错误',
      rank: 9
    },
    children: [
      {
        path: '/error/403',
        name: '403',
        component: () => import('@/views/error/403.vue'),
        meta: {
          title: '无权限访问'
        }
      },
      {
        path: '/error/404',
        name: '404',
        component: () => import('@/views/error/404.vue'),
        meta: {
          title: '页面不存在'
        }
      },
      {
        path: '/error/500',
        name: '500',
        component: () => import('@/views/error/500.vue'),
        meta: {
          title: '服务器错误'
        }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)',
    name: 'notFound',
    redirect: '/error/404'
  }
]
